//系统用户管理模块数据仓库
const state = {
  UserList:[],
  loading:false,
  pager:{
    currentPage:1,
    pageSize:10,
    currentStatus:"5",//默认显示所有
    prevStatus:5,//上一次加载过的数据
    total:0,//总记录数
  }, 
  statusPanel: [//用户列表标签页数据
    {
      name: "所有账户",
      status: "5"
    },
    {
      name: "待激活",
      status: "0"
    },
    {
      name: "正常",
      status: "1"
    },
    {
      name: "已锁定",
      status: "2"
    },
    {
      name: "已停用",
      status: "3"
    },
    {
      name: "已注销",
      status: "4"
    }
  ],
}

const getters = {
  getUserList(state){
    return state.UserList;
  },
  getLoading(state){
    return state.loading;
  },
  getPager(state){
    return state.pager;
  },
  getStatusPanel(state){//获取标签页分类数据
    return state.statusPanel;
  }
}

const mutations = {
   setUserList(state , payload){
     state.UserList = payload;
   },
   setLoading(state , payload){
      state.loading = payload;
   },
   setPager(state , payload){//payload中指定设置的属性名字 和值 {currentStatus:1}
     Object.keys(payload).forEach((key)=>{
       state.pager[key] = payload[key];
     })
   }
}

export default {
  namespaced:"systemuser",
  state,
  getters,
  mutations
}